<template>
  <div class="swiper-wrap">
    <h2>服务对象</h2>
    <swiper :options="swiperOption1" v-if="showSwiper">
      <swiper-slide v-for="(item,index) of swiperList1" :key="index">
        <div class="left">
          <img :src="item.bgImg" alt="" class="bgimg">
          <div class="mask">
            <div class="icon">
              <p>{{item.title}}</p>
            </div>
          </div>
        </div>
        <div class="right">
          <p class="detail">{{item.detail}}</p>
        </div>
      </swiper-slide>
    </swiper>
      <div class="swiper-button-prev swiper-button-black"></div>
      <div class="swiper-button-next swiper-button-black"></div>
  </div>
</template>
<script>
export default {
  name: 'HomeSwiper',
  data () {
    return {
      swiperOption1: {
        loop: true,
        autoplay: {
          autoplay: true,
          delay: 3000,
          disableOnInteraction: false
        },
        touchRatio: 0.5,
        navigation: {
          nextEl: '.swiper-button-next',
          prevEl: '.swiper-button-prev'
        }
      },
      swiperList1: [{
        title: '私家车车主',
        bgImg: require('@/assets/img/index/fw-bg-1.jpg'),
        icon: require('@/assets/img/index/car-icon-1.png'),
        detail: '我们为您提供3、6、10期的汽车商业保险分期服务，为您减轻生活压力，让你轻松面对汽车保养、油费、以及突发情况产生的费用。'
      }, {
        title: '网约车/出租车公司',
        bgImg: require('@/assets/img/index/fw-bg-2.jpg'),
        icon: require('@/assets/img/index/car-icon-2.png'),
        detail: '为企业定制最高为10期的汽车商业保险分期服务，以帮助网约车/出租车司机减轻每月资金压力，人性化的减轻营运车高额的保费负担，让企业招募司机更容易，效益增长更迅猛。'
      }, {
        title: '物流公司',
        bgImg: require('@/assets/img/index/fw-bg-3.jpg'),
        icon: require('@/assets/img/index/car-icon-3.png'),
        detail: '我们为物流公司提供了3、6、10期的汽车商业险及货运险分期服务，帮助您缓解资金周转压力，让您从容面对司机工资、油费、过路费、车辆日常维修保养产生的费用。'
      }]
    }
  },
  computed: {
    showSwiper () {
      return this.swiperList1.length
    }
  }
}
</script>

<style lang="scss" scoped>
.swiper-button-prev{
  left: 25px;
  top: 250px;
}
.swiper-button-next{
  top: 250px;
  right: 25px;
}
.swiper-wrap{
  position: relative;
  h2{
    font-size: 30px;
    color: #232323;
    padding: 50px 0 30px 0;
    text-align: center;
    font-weight: bold;

  }
  .swiper-container{
    width: 590px;
    font-size: 18px;
    color: #fff;
    margin: 0 80px;
    .swiper-slide{
      display: flex;
      flex-direction:initial;
    }
    .left{
      width: 200px;
      height: 280px;
      position: relative;
      .bgimg{
        position: absolute;
        top: 0;
        left: 0;
        width: 200px;
        height: 280px;
      }
      .mask{
        position: absolute;
        left: 0;
        bottom: 0;
        width: 200px;
        height: 34px;
        z-index: 2;
        background: rgba(0,0,0,0.8);
        font-size: 22px;
        p{
          text-align: center;
          line-height: 34px;
        }
      }
    }
    .right{
      width: 395px;
      height: 280px;
      background: #f87372;
      box-sizing: border-box;
      padding: 0 16px;
      font-size: 22px;
      display: flex;
      align-items: center;
      text-indent: 2em;
    }
  }

}
</style>
